package com.szholly.pro.watergas_server.ps.data;

import java.util.HashMap;

import com.szholly.data.general.metadata.table.DefulatDomainTable;import org.springframework.stereotype.Component;import com.szholly.data.general.Field;import com.szholly.data.general.InterceptorTableBase;import com.szholly.data.general.metadata.IBaseTable;import com.szholly.utils.spring.SpringBeanFactory;import org.springframework.stereotype.Component;import com.szholly.data.general.GlobalDataType;import com.szholly.data.general.RowBase;
/**
 * ProjectItem
 */
@Component("ProjectItem")
public class ProjectItemTable extends InterceptorTableBase  implements IBaseTable{

	public final static String TABLE_NAME = "PROJECT_ITEM";
	
	/**
	 * single ref
	 */
	public static ProjectItemTable getSingleRef() {
		return (ProjectItemTable) SpringBeanFactory.getBean("ProjectItem");
	}

	@Override
	public String getMetadataTableName() {
		return TABLE_NAME;
	}

	@Override
	public String getMetadataTableAliasName() {
		return "ProjectItem";
	}

	private HashMap<String, Field> fields;

	@Override
	protected HashMap<String, Field> fields() {
		if (fields == null) {
			fields = new HashMap<String, Field>();

			Field itemField = new Field();
			itemField.setFieldName(RowBase.FIELD_GUID);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(1);
			itemField.setFieldAliasName("GUID");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_District);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(4);
			itemField.setFieldAliasName("DISTRICT");
			itemField.setCanShow(false);
			itemField.setDefaultValue("sysdate");
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_StartTime);
			itemField.setDataType(GlobalDataType.DateTime);
			itemField.setFieldID(6);
			itemField.setFieldAliasName("START_TIME");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_ItemNo);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(7);
			itemField.setUniqueGroup("ITEM_NO");
			itemField.setFieldAliasName("ITEM_NO");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_EndTime);
			itemField.setDataType(GlobalDataType.DateTime);
			itemField.setFieldID(8);
			itemField.setFieldAliasName("END_TIME");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_ProjectNo);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(9);
			itemField.setFieldAliasName("PROJECT_NO");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_DetectionRoad);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(10);
			itemField.setFieldAliasName("DETECTION_ROAD");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_Street);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(11);
			itemField.setFieldAliasName("STREET");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_DetectionCompany);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(12);
			itemField.setFieldAliasName("DETECTION_COMPANY");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_DetectionLength);
			itemField.setDataType(GlobalDataType.Double);
			itemField.setFieldID(13);
			itemField.setFieldAliasName("DETECTION_LENGTH");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(ProjectItemRow.FIELD_ItemName);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(14);
			itemField.setFieldAliasName("ITEM_NAME");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
		}
		return fields;
	}

	@Override
	public String getTableGroup() {
		return "ProjectItem";
	}
}